<template>
  <div class="father">
    <div class="titleBox">
      <comNavigation height="45px">
        <template v-slot:title>
          推荐关注
        </template>
      </comNavigation>
    </div>
    <comScrollView @onReachBottom="onReachBottom">
    <recommend :list="list" />
  </comScrollView>
  </div>
</template>

<script setup lang="ts">
import recommend from '@/components/common/com-recommend/com-recommend.vue'
// 滚动容器
import comScrollView from '@/components/common/com-scrollView/com-scrollView.vue'
// 导航组件
import comNavigation from '@/components/common/com-navigationBar/com-navigation.vue'
import type { patient } from '@/types/home'
import { onMounted, ref } from 'vue';
// 推荐关注接口
import { getHomePageDocAPI } from '@/api/home'
import type { rowss } from '@/types/types';
import type { PageDocs } from '@/types/home';
//接口返回的数据
const list = ref<PageDocs[]>([])
let num=ref(1)
onMounted(async () => {
  let res = await getHomePageDocAPI(num.value, 10)
  list.value = res.data.data.rows
})

const onReachBottom = async()=>{
 num.value++
 let res=await getHomePageDocAPI(num.value, 10)
  list.value.push(... res.data.data.rows)
}
</script>

<style scoped lang="scss">
.father {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;

  .titleBox {
    width: 100%;
    height: 45px;
    line-height: 45px;
    background-color: aliceblue;
    text-align: center;

  }

  .center {
    width: 100%;
    flex: 1;

    .listBox {
      width: 96%;
      height: 60px;
      padding: 12px 2%;
      background-color: rgb(255, 255, 255);
      display: flex;

      .imgBox {
        width: 50px;
        height: 50px;
        border-radius: 50px;
        background-color: aliceblue;
        margin-right: 5px;

        img {
          width: 100%;
          height: 100%;
          border-radius: 50px;
        }
      }

      .cenBox {
        flex: 1;
        overflow: hidden;
        overflow: auto;
        // margin-top: 7px;
        font-size: 12px;

        .title {
          width: 100%;
          margin-bottom: 5px;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 1;
          overflow: hidden;
          text-overflow: ellipsis;
          color: #A0A0A0;

          .btn {
            width: 40px;
            padding: 0;
            border: none;
            background-color: #677FFF;
            color: white;
            border-radius: 2px
          }
        }
      }

      .butBox {
        width: 55px;
        height: 30px;
        margin-top: 15px;
        border: none;
        border-radius: 20px;
        background-color: #E9F7F6;
        color: #37B9AA;
      }
    }
  }
}
</style>
